app.controller('baseController', function ($scope) {
    $scope.reload = true;
    $scope.paginationConf = {
        currentPage: 1,
        totalItems: 0,
        itemsPerPage: 5,
        perPageOptions: [5, 10, 15, 20, 25],
        onChange: function () {
            if (!$scope.reload) {
                return;
            }
            $scope.reloadList();
        }
    };
    $scope.reloadList = function () {
        $scope.search($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
    };
    $scope.checkedIds = {ids:[]};
    $scope.updateChecked = function ($event, id) {
        if ($event.target.checked) {
            $scope.checkedIds.ids.push(id);
        } else {
            var index = $scope.checkedIds.ids.indexOf(id);
            $scope.checkedIds.ids.splice(index, 1)
        }
    };
    $scope.jsonToString=function(jsonString,key){
        var json=JSON.parse(jsonString);
        var value="";
        for(var i=0;i<json.length;i++){
            if(i>0){
                value+=",";
            }
            value+=json[i][key];
        }
        return value;
    }
});